#include <stdio.h>
int main(){
    int i;
    double j;
    scanf("%d %lf",&i,&j);
    if (i==0){
        j=(j-32)*5/9;
        printf("%.2lf",j);
    }
    else if (i==1){
        j=(j*9/5)+32;
        printf("%.2lf",j);
    }
}


//以下是题目
// Ritchie, an American California young man. It is the first time he goes abroad, and also the first time he fells the real “Cool” for the suddenly dropping of air temperature in North of China recent weeks, which makes him feeling not very well. Moreover, the weather forecasts of Medias are all in Centigrade(C) degree, not in Fahrenheit (F) degree, with which he was always familiar.
// Could you please help him to solve this daily problem so that he could adopt himself in foreign land ASAP? You may have the inter-conversion formulas as：
// 例如，华氏度转摄氏度的公式为
// .
// Please use the virtual button to choose the conversions, the virtual button of F to C is 0; and that of C to F is 1.
// INPUT:
// Your code should have two data input, one is the virtual button, and the other is the temperature to be changed. (输入两个数，一个用于选择华氏度转摄氏度还是摄氏度转华氏度，另一个代表输入的温度)
// OUTPUT:
// Please output the degree that is rounded to two digits after the decimal point.

// Requirements:
// 1. Learn and practice how to program on IDE, such as VC, CB, etc.
// 2. Abide by the rules or routines of coding style as much as possible.
// 3. Have the correct arithmetic expression in C language and the right usage of constant and variable, as well as properly input/output.
// 4. Examples of the input/output of the program are as follows.
// 0 100
// The Centigrade is 37.78
// 1 -6.67
// The Fahrenheit is 19.99
// 0 0
// The Centigrade is -17.78

// 参考代码：已知华氏温度，求解摄氏温度的办法：
// #include<stdio.h>
// int main (void)
// {
//     int celsius, fahr;
// printf("请输入要转换的华氏度：\n");
// scanf("%d", &fahr);
// celsius=5*(fahr-32)/9;
// printf("fahr=%d, celsius=%d\n",f ahr, celsius);
// return 0;
// }

//功能改进：
// （1）学习if 判断语句语法，根据输入，判断用户是想将华氏度转摄氏度还是摄氏度转华氏度；
// （2）学习如何存储和打印实数（含盖小数）；
// （3）考虑扩展功能：如，控制打印小数的位数等。